package com.qfedu.service.impl;

import com.github.pagehelper.PageHelper;
import com.qfedu.dao.SignDao;
import com.qfedu.dto.SignName;
import com.qfedu.service.SignService;
import com.qfedu.vo.SignEcharts;
import com.qfedu.vo.VSign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @Author 刘浩
 * @Date 2020/9/1 15:43
 */
@Service
public class SignServiceImpl implements SignService {
    @Autowired
    private SignDao signDao;
    @Override
    public List<VSign> selectSign(Integer page, Integer limit, String name) {
        PageHelper.startPage(page, limit);
        List<VSign> vSigns = signDao.selectSign(name);
        return vSigns;
    }

    @Override
    public SignEcharts tb() {

        List<SignName> names = signDao.names();
        SignEcharts signEcharts = new SignEcharts();
        signEcharts.setNames(new ArrayList<>());
        signEcharts.setNums(new ArrayList<>());
        for (SignName name : names) {
            signEcharts.getNames().add(name.getName());
            signEcharts.getNums().add(name.getNum());

        }
        return signEcharts;
    }

}
